package tedu.api.exception;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class AutoCloseableDemo {
    public static void main(String[] args) {
        System.out.println("开始了");

        try(
            FileOutputStream fos = new FileOutputStream("fos.txt");
            OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
            BufferedWriter bw = new BufferedWriter(osw);
            PrintWriter pw = new PrintWriter(bw);
        ){
            pw.println("741852963");
            pw.println("qwertsdf");
        }catch (IOException e){
            e.printStackTrace();
        }

        System.out.println("结束了");

    }
}
